#include"exit.h"
#include"thread.h"
#include"process.h"

//terminate calling process
void sys_exit(int32_t status){
	task_tcb* curr;
	task_tcb* parent;
	curr=current_thread();
	curr->exit_status=status;
	process_resource_release(curr);
	//made current process's child to init	
	child_adopt(curr);
	parent=pid2thread(curr->ppid);
	if(parent && parent->status==TASK_WAITING){
		thread_unblock(parent);
	}
	thread_block(TASK_HANGING);
}
